Quiz 3
We'll cover the following
Question # 1#
Tim just joined your team and noticed the home page load time was very slow. He figured that the SQL query that returned data to the front end was running slowly. He determined the fix to create indexes on all the columns of the table. As a senior member of the team, why or why not do you think his solution is right?
Blindly declaring indexes on all columns of a table is a bad idea most of the time, for the following reasons:
-
An index takes up disk space. More indexes mean higher disk space usage, potentially reaching the limit of the underlying operating system’s storage.
-
Write queries including inserts, updates, and deletes.
Question # 2
Consider we have two tables A and B. Table A has 10 rows and Table B has 13 rows. What will be the number of rows in the result set if we do a cross join (cartesian product) between the two tables?
A)
23
B)
100
C)
130
Question # 3
Consider the following table: Table A
ID |
---|
1 |
5 |
8 |
What will be the number of rows and columns produced by the following query:
SELECT *
FROM A t1
INNER JOIN A t2
ON t1.ID = t2.ID;
A)
3 rows and 2 columns
B)
6 rows and 3 columns
C)
9 rows and 2 columns
Question # 4
Consider the following table Table A
ID |
---|
1 |
5 |
8 |
What will be the number of rows and columns produced by the following query:
SELECT *
FROM A t1
INNER JOIN A t2;
A)
3 rows and 2 columns
B)
6 rows and 2 columns
C)
9 rows and 2 columns
Question # 5
Consider the following table Table A
ID |
---|
1 |
5 |
8 |
What will be the number of rows and columns produced by the following query:
SELECT *
FROM A t1
LEFT JOIN A t2
ON t1.ID = t2.ID;
A)
1 row and 2 columns
B)
3 rows and 2 columns
C)
9 rows and 2 columns